import { BasePlatform } from '../BasePlatform';

export class WX extends BasePlatform {

    constructor(id: string = '', key: string = '', video: string[] = [], banner: string[] = [], interstitial: string[] = [], custom: string[] = []) {
        super(window['wx'], id, key, video, banner, interstitial, custom)
        console.log('微信平台加载完毕')
    }
    
    share(callback?: (success: boolean) => void, channel?: string): void {
        this.shareAppMessage(callback)
    }

    shareAppMessage(callback?: (success: boolean) => void) {
        this.platform.shareAppMessage({
            success(res) {
                console.log("分享成功", res)
                if (callback)
                    callback(true)
            },
            fail(e) {
                console.log("分享失败", e)
                if (callback)
                    callback(false)
            }
        })
    }
}


